<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员注册</title>
    <!-- 引入Bootstrap CSS框架 -->
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f5f5f5;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .admin-register-form {
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .form-control {
            margin-bottom: 10px;
        }
        .btn-submit {
            background-color: #4CAF50;
            border: none;
            color: white;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
        }
        .btn-submit:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <div class="container admin-register-form">
        <h2>管理员注册</h2>
        <form action="adminRegister2.jsp" name="form1" method="post" onSubmit="return checkAdminRegistration()">
            <!-- 餐厅ID -->
            <div class="form-group">
                <label for="restaurant_id">餐厅ID:</label>
                <input type="text" class="form-control" id="restaurant_id" name="restaurant_id" required />
            </div>
            
            <!-- 管理员账号 -->
            <div class="form-group">
                <label for="admin_id">管理员账号:</label>
                <input type="text" class="form-control" id="admin_id" name="admin_id" required />
            </div>
            
            <!-- 管理员密码 -->
            <div class="form-group">
                <label for="admin_pwd">密码:</label>
                <input type="password" class="form-control" id="admin_pwd" name="admin_pwd" required />
            </div>
            
            <!-- 管理员姓名 -->
            <div class="form-group">
                <label for="admin_name">姓名:</label>
                <input type="text" class="form-control" id="admin_name" name="admin_name" required />
            </div>
            
            <!-- 提交按钮 -->
            <button type="submit" class="btn-submit">注册</button>
        </form>
    </div>

    <!-- 引入Bootstrap和jQuery脚本 -->
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
    <script>
        function checkAdminRegistration() {
            // JavaScript验证逻辑
            var restaurantId = document.getElementById('restaurant_id').value;
            var adminId = document.getElementById('admin_id').value;
            var adminPwd = document.getElementById('admin_pwd').value;
            var adminName = document.getElementById('admin_name').value;

            if (!restaurantId) {
                alert('餐厅ID不能为空!');
                return false;
            }
            if (!adminId) {
                alert('管理员账号不能为空!');
                return false;
            }
            if (!adminPwd) {
                alert('密码不能为空!');
                return false;
            }
            if (!adminName) {
                alert('姓名不能为空!');
                return false;
            }
            // 其他验证...

            return true; // 验证通过
        }
    </script>
</body>
</html>